package com.pro.app.service;

import com.pro.db.domain.ProRegion;
import com.pro.db.service.ProRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zhy
 * @date 2019-01-17 23:07
 **/
@Component
public class MercGetRegionService {

	@Autowired
	private ProRegionService regionService;

	private static List<ProRegion> proRegions;

	protected List<ProRegion> getNearbyshopRegions() {
		if(proRegions ==null){
			createRegion();
	}
		return proRegions;
	}

	private synchronized void createRegion(){
		if (proRegions == null) {
			proRegions = regionService.getAll();
		}
	}
}
